
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <title>第一章 第1节 · Python玩转自动化运维</title>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.1.0">
        <meta name="author" content="EthanYue">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-mind-maps/mindmaps.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-ck-theme/test.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-page-treeview/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-ancre-navigation/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-insert-logo/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-lou/lou.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../2第二节/" />
    
    
    <link rel="prev" href="../" />
    

    </head>
    <body>
         
<div class="donate-modal modal">
  <div class="modal-header">
    <div>
      <span>
        <img
          id="modal-avatar"
          class="modal-avatar"
          src="assets/touxiang.jpg"
        />
      </span>
      <span id="nickname"> 作者 </span>
      <p class="modal-close close" onclick="closeDonateModal()">×</p>
    </div>
    <div class="message">
      <div class="tip">
        <i></i>
        <span>随意打赏，但不要超过一顿早餐钱 💕</span>
      </div>
    </div>
  </div>
  <div class="modal-content">
    <div class="modal-pay-way">
      <div id="wxpay" onclick="showDonateImg(0)">
        <input
          type="radio"
          name="pay-way"
          value="wxpay"
          class="zs-type"
          checked="checked"
        />
        <span>
          <img
            id="wxpay-logo"
            src=""
          />
        </span>
      </div>
      <div id="alipay" onclick="showDonateImg(1)">
        <input type="radio" name="pay-way" value="alipay" class="zs-type" />
        <span>
          <img
            id="alipay-logo"
            src=""
          />
        </span>
      </div>
    </div>
    <div class="modal-pay-qrcode">
      <img id="wxpay-code" src="http://xkapp-uat.oss-cn-hangzhou.aliyuncs.com/2e7a3f70-80ab-4b50-93ec-a04dfeef949b/wxpay-any-200.png" />
      <img
        id="alipay-code"
        src="background.jpg"
        hidden
      />
    </div>
  </div>
</div>
<div class="mask"></div>


<div class="book">
  <div class="header-inner">
    <!-- LOGO -->
    <div class="logo"></div>
    <span class="title"></span>

    <!-- Search -->
    
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>


    <!-- Nav -->
    <ul class="header-nav">
      <li>
        <a href="https://juejin.cn/user/3175847616053341" target="_blank">知乎</a>
      </li><li>
        <a href="https://blog.csdn.net/weixin_40489165?type=blog" target="_blank">CSDN</a>
      </li>
    </ul>
  </div>

  <div class="book-summary">
    <div class="book-summary-title">文档目录</div>
     
    <nav role="navigation">


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../0前言/">
            
                <a href="../../0前言/">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../">
            
                <a href="../">
            
                    
                    第一章
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.3.1" data-path="./">
            
                <a href="./">
            
                    
                    第一章 第1节
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../2第二节/">
            
                <a href="../2第二节/">
            
                    
                    第一章 第2节
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../3第三节/">
            
                <a href="../3第三节/">
            
                    
                    第一章 第3节
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../2第二章/">
            
                <a href="../../2第二章/">
            
                    
                    第二章
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../2第二章/1第一节/">
            
                <a href="../../2第二章/1第一节/">
            
                    
                    第二章 第1节
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../2第二章/2第二节/">
            
                <a href="../../2第二章/2第二节/">
            
                    
                    第二章 第2节
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>

</nav>
     
  </div>

  <!-- Content nav -->
  <div class="book-anchor">
    <div class="book-anchor-title"></div>

    <div class="book-anchor-body"></div>
  </div>

  <div class="book-body">
    
    <div class="body-inner">
       

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >第一章 第1节</a>
    </h1>
</div>



      <div class="page-wrapper" tabindex="-1" role="main">
        <div class="page-inner">
          
<div id="book-search-results">
    <div class="search-noresults">
    
          <section class="normal markdown-section">
             <div id="anchor-navigation-ex-navbar"><i class="fa fa-anchor"></i><ul><li><span class="title-icon "></span><a href="#python&#x57FA;&#x7840;-1"><b></b>Python&#x57FA;&#x7840;-1</a></li><ul><li><span class="title-icon "></span><a href="#&#x6458;&#x8981;"><b></b>&#x6458;&#x8981;</a></li><ul><li><span class="title-icon "></span><a href="#python&#x811A;&#x672C;&#x7684;&#x542F;&#x52A8;"><b></b>Python&#x811A;&#x672C;&#x7684;&#x542F;&#x52A8;</a></li></ul></ul></ul></div><a href="#python&#x57FA;&#x7840;-1" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><div class="treeview__container"><div class="treeview__container-title"><span class="treeview__main-title">Treeview</span><span class="treeview__copyright">Copyright &#xA9; EthanYue all right reserved, powered by <a href="https://github.com/aleen42" target="_blank" _target="blank">aleen42</a></span></div><ul>
<li><div><a href="#&#x6458;&#x8981;">&#x6458;&#x8981;</a><i class="level__parent level__item level__parent--opened" state="opened" onclick="var curState = this.getAttribute(&apos;state&apos;);var nextState = curState === &apos;opened&apos; ? &apos;hidden&apos; : &apos;opened&apos;;this.setAttribute(&apos;state&apos;, nextState);this.className = this.className.split(curState).join(nextState);var list = this.parentNode.nextElementSibling;if (nextState === &apos;hidden&apos;) {    list.style.display = &apos;none&apos;;} else {    list.style.display = &apos;block&apos;;}"></i></div>
<ul>
<li><div><a href="#python&#x811A;&#x672C;&#x7684;&#x542F;&#x52A8;">Python&#x811A;&#x672C;&#x7684;&#x542F;&#x52A8;</a><i class="level__parent level__item level__parent--opened" state="opened" onclick="var curState = this.getAttribute(&apos;state&apos;);var nextState = curState === &apos;opened&apos; ? &apos;hidden&apos; : &apos;opened&apos;;this.setAttribute(&apos;state&apos;, nextState);this.className = this.className.split(curState).join(nextState);var list = this.parentNode.nextElementSibling;if (nextState === &apos;hidden&apos;) {    list.style.display = &apos;none&apos;;} else {    list.style.display = &apos;block&apos;;}"></i></div>
<ul>
<li><div><a href="#&#x6761;&#x4EF6;&#x5224;&#x65AD;">&#x6761;&#x4EF6;&#x5224;&#x65AD;</a><i></i></div></li>
<li><div><a href="#&#x5FAA;&#x73AF;&#x8BED;&#x53E5;">&#x5FAA;&#x73AF;&#x8BED;&#x53E5;</a><i></i></div></li>
<li><div><a href="#&#x51FD;&#x6570;">&#x51FD;&#x6570;</a><i></i></div></li>
<li><div><a href="#&#x9762;&#x5411;&#x5BF9;&#x8C61;">&#x9762;&#x5411;&#x5BF9;&#x8C61;</a><i></i></div></li>
<li><div><a href="#&#x77E5;&#x8BC6;&#x603B;&#x7ED3;">&#x77E5;&#x8BC6;&#x603B;&#x7ED3;</a><i></i></div></li>
</ul></li>
</ul></li>
</ul>
</div>

<h1 id="python&#x57FA;&#x7840;-1"><a name="python&#x57FA;&#x7840;-1" class="anchor-navigation-ex-anchor" href="#python&#x57FA;&#x7840;-1"><i class="fa fa-link" aria-hidden="true"></i></a>Python&#x57FA;&#x7840;-1</h1>
<p><img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/52db3ba42d874051b34bbdfe46142f46~tplv-k3u1fbpfcp-zoom-crop-mark:1304:1304:1304:734.awebp?" width="1200" height="700"></p>
<h2 id="&#x6458;&#x8981;"><a name="&#x6458;&#x8981;" class="anchor-navigation-ex-anchor" href="#&#x6458;&#x8981;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6458;&#x8981;</h2>
<blockquote>
<p>&#x9996;&#x5148;&#x8BF4;&#x660E;&#xFF0C;&#x4EE5;&#x4E0B;&#x51E0;&#x7C7B;&#x8BFB;&#x8005;&#x8BF7;&#x81EA;&#x884C;&#x5BF9;&#x53F7;&#x5165;&#x5EA7;&#xFF1A;</p>
<ul>
<li>&#x5BF9;CMDB&#x5F88;&#x4E86;&#x89E3;&#x4F46;&#x5BF9;&#x4E8E;Python&#x8FD8;&#x6CA1;&#x6709;&#x4E0A;&#x624B;&#x7684;&#x8BFB;&#x8005;&#xFF0C;&#x5F3A;&#x70C8;&#x5EFA;&#x8BAE;&#x9605;&#x8BFB;&#x6B64;&#x7BC7;&#xFF1B;</li>
<li>&#x4E86;&#x89E3;&#x8FC7;Python&#x57FA;&#x672C;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;&#xFF0C;&#x4F46;&#x53C8;&#x6CA1;&#x6709;&#x7ECF;&#x5E38;&#x5728;&#x5B9E;&#x8DF5;&#x4E2D;&#x8FD0;&#x7528;&#x7684;&#x8BFB;&#x8005;&#xFF0C;&#x5EFA;&#x8BAE;&#x9605;&#x8BFB;&#x6B64;&#x7BC7;&#xFF1B;</li>
<li>&#x5DF2;&#x7ECF;&#x53EF;&#x4EE5;&#x719F;&#x7EC3;&#x5199;&#x51FA;Python&#x811A;&#x672C;&#xFF0C;&#x4F46;&#x5BF9;CMDB&#x4E0D;&#x662F;&#x5F88;&#x4E86;&#x89E3;&#x7684;&#x8BFB;&#x8005;&#xFF0C;&#x5EFA;&#x8BAE;&#x9605;&#x8BFB;&#x6B64;&#x7BC7;&#xFF1B;</li>
<li>&#x5373;&#x4E86;&#x89E3;Python&#xFF0C;&#x53C8;&#x4E86;&#x89E3;CMDB&#x7684;&#x8BFB;&#x8005;&#xFF0C;&#x53EF;&#x4EE5;&#x51FA;&#x95E8;&#x5DE6;&#x8F6C;&#xFF0C;&#x770B;&#x4E0B;&#x4E00;&#x7BC7;&#x3002;</li>
</ul>
</blockquote>
<p>&#x4E0A;&#x4E00;&#x8282;&#x6211;&#x4EEC;&#x901A;&#x8FC7;&#x5BF9;&#x81EA;&#x52A8;&#x5316;&#x8FD0;&#x7EF4;&#x7684;&#x57FA;&#x77F3;--CMDBv1.0&#x7684;&#x6F14;&#x793A;&#xFF0C;&#x4E3A;&#x5927;&#x5BB6;&#x8BB2;&#x4E86;Python&#x7684;&#x57FA;&#x672C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x548C;&#x76F8;&#x5173;&#x7684;&#x64CD;&#x4F5C;&#xFF0C;&#x90A3;&#x4E48;&#x8FD9;&#x4E00;&#x8282;&#x6211;&#x4EEC;&#x5C31;&#x6DF1;&#x5165;cmdb-v1.0.py&#x7684;&#x6E90;&#x7801;&#xFF0C;&#x5E76;&#x4E86;&#x89E3;&#x4E00;&#x4E0B;Python&#x7684;&#x8BED;&#x53E5;&#xFF0C;&#x51FD;&#x6570;&#x4EE5;&#x53CA;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x76F8;&#x5173;&#x7684;&#x77E5;&#x8BC6;&#x3002;</p>
<p>&#x4E00;&#x8BF4;&#x5230;&#x9605;&#x8BFB;&#x6E90;&#x7801;&#x5F88;&#x591A;&#x8BFB;&#x8005;&#x5C31;&#x8981;&#x614C;&#x4E86;&#xFF0C;&#x89C9;&#x5F97;Python&#x90FD;&#x6CA1;&#x5165;&#x95E8;&#x5C31;&#x9605;&#x8BFB;&#x6E90;&#x7801;&#x4E86;&#xFF1F;&#x9996;&#x5148;Python&#x7684;&#x4E00;&#x5927;&#x597D;&#x5904;&#x5C31;&#x662F;&#xFF0C;&#x4EE3;&#x7801;&#x7684;&#x903B;&#x8F91;&#x50CF;&#x9605;&#x8BFB;&#x82F1;&#x6587;&#x4E00;&#x6837;&#x7B80;&#x6D01;&#xFF0C;&#x5E76;&#x4E14;&#x6211;&#x4EEC;&#x7684;cmdb-v1.0.py&#x7684;&#x6E90;&#x7801;&#x53EA;&#x6709;&#x4E00;&#x767E;&#x4E00;&#x5341;&#x884C;&#x5DE6;&#x53F3;&#xFF0C;&#x5C31;&#x5B9E;&#x73B0;&#x4E86;&#x5BF9;&#x8D44;&#x4EA7;&#x6570;&#x636E;&#x589E;&#x5220;&#x6539;&#x67E5;&#x7684;&#x57FA;&#x672C;&#x529F;&#x80FD;&#xFF0C;&#x8BDD;&#x4E0D;&#x591A;&#x8BF4;&#xFF0C;&#x9A6C;&#x4E0A;&#x5F00;&#x59CB;&#xFF1A;</p>
<h3 id="python&#x811A;&#x672C;&#x7684;&#x542F;&#x52A8;"><a name="python&#x811A;&#x672C;&#x7684;&#x542F;&#x52A8;" class="anchor-navigation-ex-anchor" href="#python&#x811A;&#x672C;&#x7684;&#x542F;&#x52A8;"><i class="fa fa-link" aria-hidden="true"></i></a>Python&#x811A;&#x672C;&#x7684;&#x542F;&#x52A8;</h3>
<pre><code class="lang-python">root&gt; <span class="hljs-comment"># python ./cmdb-v1.0.py [&#x989D;&#x5916;&#x53C2;&#x6570;...]</span>
</code></pre>
<p>&#x5728;&#x547D;&#x4EE4;&#x884C;&#x4E2D;&#x76F4;&#x63A5;&#x901A;&#x8FC7;<code>python</code>&#x52A0;&#x6587;&#x4EF6;&#x540D;&#x5C31;&#x53EF;&#x4EE5;&#x6267;&#x884C;&#x8BE5;&#x811A;&#x672C;&#xFF0C;&#x90A3;&#x4E48;&#x5F53;&#x6267;&#x884C;&#x8BE5;&#x811A;&#x672C;&#x65F6;&#xFF0C;&#x811A;&#x672C;&#x5185;&#x90E8;&#x505A;&#x4E86;&#x4EC0;&#x4E48;&#x64CD;&#x4F5C;&#x5462;</p>
<pre><code class="lang-python"><span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">&quot;__main__&quot;</span>:
    operations = [<span class="hljs-string">&quot;get&quot;</span>, <span class="hljs-string">&quot;update&quot;</span>, <span class="hljs-string">&quot;delete&quot;</span>]
    args = sys.argv
    <span class="hljs-keyword">if</span> len(args) &lt; <span class="hljs-number">3</span>:
        print(<span class="hljs-string">&quot;please input operation and args&quot;</span>)
    <span class="hljs-keyword">else</span>:
        <span class="hljs-keyword">if</span> args[<span class="hljs-number">1</span>] == <span class="hljs-string">&quot;init&quot;</span>:
            init(args[<span class="hljs-number">2</span>])
        <span class="hljs-keyword">elif</span> args[<span class="hljs-number">1</span>] == <span class="hljs-string">&quot;add&quot;</span>:
            add(*args[<span class="hljs-number">2</span>:])
        <span class="hljs-keyword">elif</span> args[<span class="hljs-number">1</span>] == <span class="hljs-string">&quot;get&quot;</span>:
            get(args[<span class="hljs-number">2</span>])
        <span class="hljs-keyword">elif</span> args[<span class="hljs-number">1</span>] == <span class="hljs-string">&quot;update&quot;</span>:
            update(args[<span class="hljs-number">2</span>], args[<span class="hljs-number">3</span>])
        <span class="hljs-keyword">elif</span> args[<span class="hljs-number">1</span>] == <span class="hljs-string">&quot;delete&quot;</span>:
            delete(*args[<span class="hljs-number">2</span>:])
        <span class="hljs-keyword">else</span>:
            print(<span class="hljs-string">&quot;operation must be one of get,update,delete&quot;</span>)
</code></pre>
<p>&#x4E0A;&#x8FF0;&#x4EE3;&#x7801;&#x5C31;&#x662F;&#x6211;&#x4EEC;&#x6574;&#x4E2A;&#x811A;&#x672C;&#x7684;&#x542F;&#x52A8;&#x5165;&#x53E3;&#xFF0C;&#x5927;&#x5BB6;&#x6700;&#x5148;&#x770B;&#x5230;&#x7684;&#x5C31;&#x662F;&#x4E00;&#x884C;&#x5224;&#x65AD;&#x8BED;&#x53E5;&#xFF0C;&#x90A3;&#x6211;&#x4EEC;&#x5C31;&#x5148;&#x4ECE;&#x5224;&#x65AD;&#x8BED;&#x53E5;&#x5F00;&#x59CB;&#x8BB2;&#x8D77;</p>
<h4 id="&#x6761;&#x4EF6;&#x5224;&#x65AD;"><a name="&#x6761;&#x4EF6;&#x5224;&#x65AD;" class="anchor-navigation-ex-anchor" href="#&#x6761;&#x4EF6;&#x5224;&#x65AD;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6761;&#x4EF6;&#x5224;&#x65AD;</h4>
<blockquote>
<p>&#x4E0D;&#x7BA1;&#x54EA;&#x79CD;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#xFF0C;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x90FD;&#x662F;&#x5176;&#x6700;&#x57FA;&#x672C;&#x7684;&#x903B;&#x8F91;&#xFF0C;&#x662F;&#x8BA9;&#x4E00;&#x884C;&#x4E00;&#x884C;&#x7684;&#x4EE3;&#x7801;&#x80FD;&#x591F;&#x88AB;&#x7F16;&#x6392;&#x8D77;&#x6765;&#x7684;&#x6700;&#x57FA;&#x672C;&#x624B;&#x6BB5;&#xFF0C;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x5728;&#x4E0D;&#x540C;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x6267;&#x884C;&#x4E0D;&#x540C;&#x7684;&#x4EE3;&#x7801;&#x5757;&#xFF0C;&#x5982;&#x56FE;&#x6240;&#x793A;</p>
</blockquote>
<p><img src="https://note.youdao.com/yws/res/2043/1EADCCAAD9D44819B96E1B150746F3A2" alt="if-condition"></p>
<p>&#x4E0B;&#x9762;&#x4E3A;Python&#x5224;&#x65AD;&#x8BED;&#x53E5;&#x7684;&#x4F2A;&#x4EE3;&#x7801;&#x5F62;&#x5F0F;&#xFF0C;&#x5F53;&#x5224;&#x65AD;&#x6761;&#x4EF6;&#x4E3A;&#x771F;&#x65F6;&#x6267;&#x884C;&#x8BED;&#x53E5;1&#xFF0C;&#x4E3A;&#x5047;&#x65F6;&#x6267;&#x884C;&#x8BED;&#x53E5;2&#xFF0C;&#x6267;&#x884C;&#x8BED;&#x53E5;&#x53EF;&#x4EE5;&#x4E3A;&#x591A;&#x884C;&#xFF0C;&#x901A;&#x8FC7;&#x7F29;&#x8FDB;&#x6765;&#x63A7;&#x5236;</p>
<pre><code class="lang-python"><span class="hljs-keyword">if</span> &#x5224;&#x65AD;&#x6761;&#x4EF6;:
    &#x6267;&#x884C;&#x8BED;&#x53E5;<span class="hljs-number">1</span>
<span class="hljs-keyword">else</span>:
    &#x6267;&#x884C;&#x8BED;&#x53E5;<span class="hljs-number">2</span>
</code></pre>
<p>&#x6211;&#x4EEC;&#x7684;&#x6E90;&#x7801;&#x4E2D;&#x7684;&#x7B2C;&#x4E00;&#x884C; <code>if __name__ == &quot;__main__&quot;</code>&#xFF0C;&#x8FD9;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#x5224;&#x65AD;&#x7684;&#x8BED;&#x53E5;&#xFF0C;<code>__name__</code>&#x662F;&#x4E00;&#x4E2A;Python&#x7684;&#x5185;&#x7F6E;&#x53D8;&#x91CF;&#xFF0C;&#x5B83;&#x8868;&#x793A;&#x5F53;&#x524D;&#x88AB;&#x6267;&#x884C;&#x811A;&#x672C;&#x7684;&#x540D;&#x79F0;&#xFF0C;&#x6240;&#x4EE5;&#x6B64;&#x5904;&#x5224;&#x65AD;&#x8BED;&#x53E5;&#x7684;&#x542B;&#x4E49;&#x4E3A;<code>&#x662F;&#x5426;&#x5F53;&#x524D;&#x88AB;&#x6267;&#x884C;&#x811A;&#x672C;&#x7684;&#x540D;&#x79F0;&#x7B49;&#x4E8E;&quot;__main__&quot;</code>&#xFF0C;&#x8FD9;&#x91CC;&#x6709;&#x4E24;&#x4E2A;&#x5730;&#x65B9;&#x9700;&#x8981;&#x5927;&#x5BB6;&#x6CE8;&#x610F;&#x4E00;&#x4E0B;&#xFF1A;</p>
<ul>
<li>&#x5F53;&#x4F7F;&#x7528;<code>python &#x6587;&#x4EF6;&#x540D;.py</code>&#x7684;&#x65B9;&#x5F0F;&#x6267;&#x884C;&#x811A;&#x672C;&#x65F6;&#xFF0C;&#x8BE5;&#x811A;&#x672C;&#x7684;<code>__name__</code>&#x503C;&#x5373;&#x4E3A;<code>__main__</code></li>
<li>&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x8BED;&#x53E5;&#x4E2D;<code>&#x7B49;&#x4E8E;</code>&#x901A;&#x8FC7;<code>==</code>&#x6765;&#x8868;&#x793A;&#xFF0C;&#x800C;&#x975E;<code>=</code></li>
</ul>
<p>&#x5728;&#x638C;&#x63E1;&#x4E86;&#x5224;&#x65AD;&#x8BED;&#x53E5;&#x7684;&#x539F;&#x7406;&#x540E;&#xFF0C;&#x518D;&#x52A0;&#x4E0A;&#x6211;&#x4EEC;&#x4E0A;&#x8282;&#x5185;&#x5BB9;&#x6240;&#x8BB2;&#xFF0C;&#x6211;&#x4EEC;&#x5C31;&#x53EF;&#x4EE5;&#x7406;&#x89E3;&#x6E90;&#x7801;&#x4E2D;&#x542F;&#x52A8;&#x5165;&#x53E3;&#x7684;&#x57FA;&#x672C;&#x903B;&#x8F91;</p>
<pre><code class="lang-python"><span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">&quot;__main__&quot;</span>:  <span class="hljs-comment"># &#x5F53;&#x524D;&#x88AB;&#x6267;&#x884C;&#x811A;&#x672C;&#x7684;&#x540D;&#x79F0;&#x662F;&#x5426;&#x7B49;&#x4E8E;&quot;__main__&quot;&#xFF0C;&#x5982;&#x679C;&#x7B49;&#x4E8E;&#x6267;&#x884C;&#x4EE5;&#x4E0B;&#x8BED;&#x53E5;</span>
    args = sys.argv  <span class="hljs-comment"># &#x83B7;&#x53D6;&#x547D;&#x4EE4;&#x884C;&#x8F93;&#x5165;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x6B64;&#x5904;sys.argv&#x4E3A;python&#x7684;&#x5185;&#x7F6E;&#x65B9;&#x6CD5;</span>
    <span class="hljs-keyword">if</span> len(args) &lt; <span class="hljs-number">3</span>:  <span class="hljs-comment"># &#x5982;&#x679C;&#x53C2;&#x6570;&#x6570;&#x91CF;&#x5C0F;&#x4E8E;3&#x4E2A;&#xFF0C;&#x5219;&#x6267;&#x884C;&#x4EE5;&#x4E0B;&#x8BED;&#x53E5;</span>
        print(<span class="hljs-string">&quot;please input operation and args&quot;</span>)  <span class="hljs-comment"># &#x6253;&#x5370;&#x63D0;&#x793A;&#x5185;&#x5BB9;</span>
    <span class="hljs-keyword">else</span>:  <span class="hljs-comment"># &#x5982;&#x679C;&#x53C2;&#x6570;&#x6570;&#x91CF;&#x4E0D;&#x5C0F;&#x4E8E;3&#x4E2A;&#xFF0C;&#x5219;&#x6267;&#x884C;&#x4EE5;&#x4E0B;&#x8BED;&#x53E5;</span>
        <span class="hljs-keyword">if</span> args[<span class="hljs-number">1</span>] == <span class="hljs-string">&quot;init&quot;</span>:  <span class="hljs-comment"># &#x662F;&#x5426;&#x53C2;&#x6570;&#x7684;&#x7B2C;&#x4E8C;&#x4E2A;&#x5143;&#x7D20;&#x7B49;&#x4E8E;&quot;init&quot;(&#x6570;&#x7EC4;&#x4E0B;&#x6807;&#x4ECE;0&#x5F00;&#x59CB;)</span>
            init(args[<span class="hljs-number">2</span>])  <span class="hljs-comment"># &#x5982;&#x679C;&#x7B49;&#x4E8E;&quot;init&quot;&#x5219;&#x6267;&#x884C;&#x8BE5;&#x51FD;&#x6570;</span>
        <span class="hljs-keyword">elif</span> args[<span class="hljs-number">1</span>] == <span class="hljs-string">&quot;add&quot;</span>:  <span class="hljs-comment"># &#x5982;&#x679C;&#x4E0D;&#x7B49;&#x4E8E;&quot;init&quot;&#xFF0C;&#x5219;&#x5224;&#x65AD;&#x662F;&#x5426;&#x7B49;&#x4E8E;&quot;add&quot;</span>
            add(*args[<span class="hljs-number">2</span>:])  <span class="hljs-comment"># &#x5982;&#x679C;&#x7B49;&#x4E8E;&quot;add&quot;&#x5219;&#x6267;&#x884C;&#x8BE5;&#x51FD;&#x6570;</span>
        <span class="hljs-keyword">elif</span> args[<span class="hljs-number">1</span>] == <span class="hljs-string">&quot;get&quot;</span>:  <span class="hljs-comment"># &#x5982;&#x679C;&#x4E5F;&#x4E0D;&#x7B49;&#x4E8E;&quot;add&quot;&#xFF0C;&#x5219;&#x5224;&#x65AD;&#x662F;&#x5426;&#x7B49;&#x4E8E;&quot;get&quot;</span>
            get(args[<span class="hljs-number">2</span>])  <span class="hljs-comment"># &#x5982;&#x679C;&#x7B49;&#x4E8E;&quot;get&quot;&#x5219;&#x6267;&#x884C;&#x8BE5;&#x51FD;&#x6570;</span>
        <span class="hljs-keyword">elif</span> args[<span class="hljs-number">1</span>] == <span class="hljs-string">&quot;update&quot;</span>:  <span class="hljs-comment"># &#x5982;&#x679C;&#x4E5F;&#x4E0D;&#x7B49;&#x4E8E;&quot;get&quot;&#xFF0C;&#x5219;&#x5224;&#x65AD;&#x662F;&#x5426;&#x7B49;&#x4E8E;&quot;update&quot;</span>
            update(args[<span class="hljs-number">2</span>], args[<span class="hljs-number">3</span>])  <span class="hljs-comment"># &#x5982;&#x679C;&#x7B49;&#x4E8E;&quot;update&quot;&#x5219;&#x6267;&#x884C;&#x8BE5;&#x51FD;&#x6570;</span>
        <span class="hljs-keyword">elif</span> args[<span class="hljs-number">1</span>] == <span class="hljs-string">&quot;delete&quot;</span>:  <span class="hljs-comment"># &#x5982;&#x679C;&#x4E5F;&#x4E0D;&#x7B49;&#x4E8E;&quot;update&quot;&#xFF0C;&#x5219;&#x5224;&#x65AD;&#x662F;&#x5426;&#x7B49;&#x4E8E;&quot;delete&quot;</span>
            delete(*args[<span class="hljs-number">2</span>:])  <span class="hljs-comment"># &#x5982;&#x679C;&#x7B49;&#x4E8E;&quot;delete&quot;&#x5219;&#x6267;&#x884C;&#x8BE5;&#x51FD;&#x6570;</span>
        <span class="hljs-keyword">else</span>:  <span class="hljs-comment"># &#x5982;&#x679C;&#x90FD;&#x4E0D;&#x7B49;&#x4E8E;&#x5219;&#x6267;&#x884C;&#x4EE5;&#x4E0B;&#x6253;&#x5370;&#x8BED;&#x53E5;&#xFF0C;&#x8F93;&#x51FA;&#x63D0;&#x793A;</span>
            print(<span class="hljs-string">&quot;operation must be one of get,update,delete&quot;</span>)
</code></pre>
<p>&#x5927;&#x5BB6;&#x53EF;&#x4EE5;&#x53D1;&#x73B0;&#x53EA;&#x901A;&#x8FC7;&#x4E0A;&#x8FF0;&#x7684;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x8BED;&#x53E5;&#x5C31;&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x6211;&#x4EEC;&#x6267;&#x884C;&#x811A;&#x672C;&#x65F6;&#x7684;&#x547D;&#x4EE4;&#x884C;&#x53C2;&#x6570;&#xFF0C;&#x53BB;&#x5206;&#x522B;&#x6267;&#x884C;&#x4E0D;&#x540C;&#x7684;&#x589E;&#x5220;&#x6539;&#x67E5;&#x7684;&#x903B;&#x8F91;&#xFF0C;&#x8BFB;&#x8005;&#x53EF;&#x80FD;&#x5BF9;&#x8FD9;&#x91CC;&#x7684;<code>*arg</code>&#x6709;&#x4E00;&#x4E9B;&#x7591;&#x95EE;&#xFF0C;&#x6211;&#x4EEC;&#x4F1A;&#x5728;&#x756A;&#x5916;&#x7BC7;&#x4E2D;&#x63D0;&#x5230;&#x3002;</p>
<h4 id="&#x5FAA;&#x73AF;&#x8BED;&#x53E5;"><a name="&#x5FAA;&#x73AF;&#x8BED;&#x53E5;" class="anchor-navigation-ex-anchor" href="#&#x5FAA;&#x73AF;&#x8BED;&#x53E5;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5FAA;&#x73AF;&#x8BED;&#x53E5;</h4>
<blockquote>
<p> &#x76EE;&#x524D;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x638C;&#x63E1;&#x4E86;&#x8BA9;&#x811A;&#x672C;&#x542F;&#x52A8;&#xFF0C;&#x5E76;&#x4E14;&#x6839;&#x636E;&#x4E0D;&#x540C;&#x7684;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x53BB;&#x4F9D;&#x6B21;&#x6267;&#x884C;&#x8BED;&#x53E5;&#x7684;&#x80FD;&#x529B;&#xFF0C;&#x4E0D;&#x8FC7;&#x8FD9;&#x65F6;&#x7A0B;&#x5E8F;&#x8FD8;&#x53EA;&#x662F;&#x5728;&#x987A;&#x5E8F;&#x6267;&#x884C;&#xFF0C;&#x5982;&#x679C;&#x6211;&#x4EEC;&#x60F3;&#x67E5;&#x8BE2;&#x591A;&#x4E2A;&#x8D44;&#x4EA7;&#x4FE1;&#x606F;&#xFF0C;&#x90A3;&#x4E48;&#x5C31;&#x5FC5;&#x987B;&#x591A;&#x6B21;&#x53BB;&#x6267;&#x884C;&#x67E5;&#x8BE2;&#x7684;&#x8BED;&#x53E5;&#xFF0C;&#x8FD9;&#x65F6;&#x5019;&#x5C31;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x5FAA;&#x73AF;&#x8BED;&#x53E5;&#xFF0C;&#x5FAA;&#x73AF;&#x8BED;&#x53E5;&#x53EF;&#x4EE5;&#x8BA9;&#x6211;&#x4EEC;&#x6267;&#x884C;&#x67D0;&#x4E00;&#x4E2A;&#x4EE3;&#x7801;&#x5757;&#x591A;&#x6B21;&#xFF0C;&#x5982;&#x56FE;&#x6240;&#x793A;</p>
</blockquote>
<p><img src="https://note.youdao.com/yws/res/2044/48477676D7B44D50ACCADE9820AA485E" alt="loop"></p>
<p>Python&#x4E2D;&#x7684;&#x5FAA;&#x73AF;&#x8BED;&#x53E5;&#x7684;&#x4F2A;&#x4EE3;&#x7801;&#x5F62;&#x5F0F;&#x5982;&#x4E0B;&#x6240;&#x793A;</p>
<pre><code class="lang-python"><span class="hljs-keyword">for</span> &#x5224;&#x65AD;&#x6761;&#x4EF6;:  <span class="hljs-comment"># &#x53EA;&#x8981;&#x5224;&#x65AD;&#x6761;&#x4EF6;&#x4E3A;&#x771F;&#x5C31;&#x4F1A;&#x4E00;&#x76F4;&#x6267;&#x884C;&#x8BED;&#x53E5;1</span>
    &#x6267;&#x884C;&#x8BED;&#x53E5;<span class="hljs-number">1</span>
</code></pre>
<p>&#x7531;&#x4E8E;&#x5FAA;&#x73AF;&#x8BED;&#x53E5;&#x76F8;&#x5BF9;&#x6BD4;&#x8F83;&#x597D;&#x7406;&#x89E3;&#xFF0C;&#x6211;&#x4EEC;&#x5C31;&#x5148;&#x7B80;&#x5355;&#x4ECB;&#x7ECD;&#x4EE5;&#x4E0B;&#xFF0C;&#x540E;&#x9762;&#x7684;&#x6E90;&#x7801;&#x4E2D;&#x9047;&#x5230;&#x65F6;&#xFF0C;&#x518D;&#x6DF1;&#x5165;&#x8BB2;&#x89E3;&#x4E00;&#x4E9B;&#x7EC6;&#x8282;</p>
<h4 id="&#x51FD;&#x6570;"><a name="&#x51FD;&#x6570;" class="anchor-navigation-ex-anchor" href="#&#x51FD;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x51FD;&#x6570;</h4>
<blockquote>
<p>&#x901A;&#x8FC7;&#x4E0A;&#x9762;&#x7684;&#x5B66;&#x4E60;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x80FD;&#x591F;&#x6BD4;&#x8F83;&#x597D;&#x7684;&#x7F16;&#x6392;&#x81EA;&#x5DF1;&#x7684;&#x4EE3;&#x7801;&#x53BB;&#x987A;&#x5E8F;&#x6267;&#x884C;&#x6216;&#x8005;&#x5FAA;&#x73AF;&#x6267;&#x884C;&#xFF0C;&#x4F46;&#x5BF9;&#x4E8E;&#x4E00;&#x4E9B;&#x53EF;&#x4EE5;&#x91CD;&#x590D;&#x4F7F;&#x7528;&#x7684;&#x8BED;&#x53E5;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x628A;&#x5176;&#x7EC4;&#x7EC7;&#x8D77;&#x6765;&#xFF0C;&#x5C06;&#x5B83;&#x4EEC;&#x5B9A;&#x4E49;&#x4E3A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#xFF0C;&#x8FD9;&#x6837;&#x6211;&#x4EEC;&#x540E;&#x7EED;&#x5C31;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x53BB;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x51FD;&#x6570;&#xFF0C;&#x800C;&#x4E0D;&#x5FC5;&#x6BCF;&#x6B21;&#x90FD;&#x7F16;&#x5199;&#x5927;&#x91CF;&#x76F8;&#x540C;&#x7684;&#x8BED;&#x53E5;&#x3002;</p>
</blockquote>
<p>Python&#x4E2D;&#x7684;&#x51FD;&#x6570;&#x4F2A;&#x4EE3;&#x7801;&#x5F62;&#x5F0F;&#x5982;&#x4E0B;&#x6240;&#x793A;</p>
<pre><code class="lang-python">def &#x51FD;&#x6570;&#x540D;&#x79F0;(&#x53C2;&#x6570;...)&#xFF1A;
    &#x4EE3;&#x7801;&#x5757;
</code></pre>
<p>&#x6BD4;&#x5982;&#x6211;&#x4EEC;&#x6E90;&#x7801;&#x4E2D;&#x5B9A;&#x4E49;&#x7684;&#x67E5;&#x8BE2;&#x8D44;&#x4EA7;&#x4FE1;&#x606F;&#x7684;&#x51FD;&#x6570;&#x7684;&#x4F2A;&#x4EE3;&#x7801;&#x5982;&#x4E0B;</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(path)</span>:</span>  <span class="hljs-comment"># &#x51FD;&#x6570;&#x540D;&#x79F0;&#x4E3A; get&#xFF0C; &#x63A5;&#x53D7;&#x4E00;&#x4E2A;&#x53C2;&#x6570; path</span>
    &#x6253;&#x5F00;&#x8D44;&#x4EA7;&#x4FE1;&#x606F;&#x7684;&#x6587;&#x4EF6;
    &#x6839;&#x636E;&#x53C2;&#x6570;path&#x53BB;&#x67E5;&#x8BE2;&#x8D44;&#x4EA7;&#x4FE1;&#x606F;&#x4E2D;&#x5BF9;&#x5E94;&#x7684;&#x4FE1;&#x606F;
    &#x6253;&#x5370;&#x76F8;&#x5173;&#x4FE1;&#x606F;
</code></pre>
<p>&#x5F53;&#x6211;&#x4EEC;&#x5B9A;&#x4E49;&#x597D;&#x8FD9;&#x6837;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x4E4B;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x540E;&#x7EED;&#x5C31;&#x53EF;&#x4EE5;&#x5341;&#x5206;&#x65B9;&#x4FBF;&#x7684;&#x53BB;&#x8C03;&#x7528;&#x5B83;&#xFF0C;&#x8C03;&#x7528;&#x7684;&#x65B9;&#x6CD5;&#x5C31;&#x662F;</p>
<pre><code class="lang-python">info = get(<span class="hljs-string">&quot;/beijing/switch/10.0.0.1&quot;</span>)
</code></pre>
<p>&#x5176;&#x5B9E;&#x51FD;&#x6570;&#x7684;&#x672C;&#x610F;&#x5C31;&#x662F;&#x6211;&#x4EEC;&#x5C06;&#x4E00;&#x4E9B;&#x53EF;&#x88AB;&#x590D;&#x7528;&#x7684;&#x4EE3;&#x7801;&#x8FDB;&#x884C;&#x63D0;&#x53D6;&#xFF0C;&#x5C06;&#x5176;&#x4E2D;&#x53EF;&#x53D8;&#x7684;&#x53D8;&#x91CF;&#x4F5C;&#x4E3A;&#x53C2;&#x6570;&#x4F20;&#x5165;&#xFF0C;&#x800C;&#x5C06;&#x5176;&#x76F8;&#x540C;&#x7684;&#x903B;&#x8F91;&#x4FDD;&#x7559;&#xFF0C;&#x8FD9;&#x6837;&#x6211;&#x4EEC;&#x6BCF;&#x6B21;&#x53EA;&#x9700;&#x8981;&#x4F20;&#x5165;&#x4E0D;&#x540C;&#x7684;&#x53C2;&#x6570;&#x5C31;&#x53EF;&#x4EE5;&#x6267;&#x884C;&#x8BE5;&#x903B;&#x8F91;&#xFF0C;&#x4E0D;&#x7528;&#x5728;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x8BE5;&#x903B;&#x8F91;&#x7684;&#x5730;&#x65B9;&#x518D;&#x6B21;&#x7F16;&#x5199;&#x5197;&#x4F59;&#x7684;&#x4EE3;&#x7801;</p>
<p>&#x6BD4;&#x5982;&#x5728;&#x811A;&#x672C;&#x7684;&#x542F;&#x52A8;&#x5165;&#x53E3;&#x5730;&#x65B9;&#xFF0C;&#x5982;&#x4E0B;</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">init</span><span class="hljs-params">(path)</span>:</span>
    ...

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(path)</span>:</span>
    ...

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">delete</span><span class="hljs-params">(path)</span>:</span>
    ...

<span class="hljs-keyword">if</span> args[<span class="hljs-number">1</span>] == <span class="hljs-string">&quot;init&quot;</span>:
    init(args[<span class="hljs-number">2</span>])
<span class="hljs-keyword">elif</span> args[<span class="hljs-number">1</span>] == <span class="hljs-string">&quot;get&quot;</span>:
    get(args[<span class="hljs-number">2</span>])
<span class="hljs-keyword">else</span>:
    print(<span class="hljs-string">&quot;operation must be one of get,update,delete&quot;</span>)
</code></pre>
<p>&#x6211;&#x4EEC;&#x53EA;&#x9700;&#x8981;&#x5728;&#x6267;&#x884C;&#x811A;&#x672C;&#x65F6;&#xFF0C;&#x901A;&#x8FC7;&#x5224;&#x65AD;&#x547D;&#x4EE4;&#x884C;&#x7684;&#x6307;&#x4EE4;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x53BB;&#x6267;&#x884C;&#x4E0D;&#x540C;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x5341;&#x5206;&#x65B9;&#x4FBF;&#xFF0C;&#x4F46;&#x8FD9;&#x91CC;&#x6709;&#x4E24;&#x4E2A;&#x5730;&#x65B9;&#x9700;&#x8981;&#x5927;&#x5BB6;&#x6CE8;&#x610F;&#x4EE5;&#x4E0B;</p>
<ul>
<li>&#x5B9A;&#x4E49;&#x7684;&#x51FD;&#x6570;&#x53EA;&#x662F;&#x8BED;&#x53E5;&#x7684;&#x62BD;&#x8C61;&#x903B;&#x8F91;&#xFF0C;&#x5982;&#x679C;&#x4E0D;&#x8C03;&#x7528;&#x5B83;&#xFF0C;&#x90A3;&#x4E48;&#x5B83;&#x5C31;&#x6C38;&#x8FDC;&#x4E0D;&#x4F1A;&#x6267;&#x884C;&#xFF0C;&#x6BD4;&#x5982;&#x5982;&#x679C;&#x6211;&#x4EEC;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;&#x5220;&#x9664;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x4F46;&#x59CB;&#x7EC8;&#x90FD;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x5730;&#x65B9;&#x53BB;&#x8C03;&#x7528;&#x5B83;&#xFF0C;&#x90A3;&#x4E48;&#x5B83;&#x5C31;&#x6C38;&#x8FDC;&#x4E0D;&#x4F1A;&#x88AB;&#x6267;&#x884C;</li>
<li><code>print()</code>&#x5176;&#x5B9E;&#x4E5F;&#x662F;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#xFF0C;&#x53EA;&#x4E0D;&#x8FC7;&#x5B83;&#x662F;Python&#x7684;&#x5185;&#x7F6E;&#x51FD;&#x6570;&#xFF0C;&#x5B83;&#x7684;&#x529F;&#x80FD;&#x76F8;&#x5F53;&#x4E8E;&#x63A5;&#x6536;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5E76;&#x5C06;&#x5176;&#x8F93;&#x51FA;&#x5230;&#x5C4F;&#x5E55;&#x4E0A;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x5176;&#x5B9E;&#x5728;&#x5C1D;&#x8BD5;&#x7F16;&#x5199;&#x7B2C;&#x4E00;&#x4E2A;python&#x7A0B;&#x5E8F;<code>print(&quot;hello world&quot;)</code>&#x65F6;&#xFF0C;&#x5C31;&#x5DF2;&#x7ECF;&#x65E0;&#x5F62;&#x4E2D;&#x4F7F;&#x7528;&#x5230;&#x4E86;&#x51FD;&#x6570;</li>
</ul>
<blockquote>
<p>Tips</p>
<p>&#x5927;&#x5BB6;&#x53EF;&#x4EE5;&#x8BBE;&#x60F3;&#x4EE5;&#x4E0B;&#xFF0C;&#x5982;&#x679C;&#x6BCF;&#x6B21;&#x6211;&#x4EEC;&#x60F3;&#x5C06;&#x5185;&#x5BB9;&#x8F93;&#x51FA;&#x5230;&#x5C4F;&#x5E55;&#xFF0C;&#x90FD;&#x9700;&#x8981;&#x81EA;&#x5DF1;&#x53BB;&#x7F16;&#x5199;print&#x7684;&#x5185;&#x90E8;&#x903B;&#x8F91;&#x7EC6;&#x8282;&#xFF0C;&#x90A3;&#x7B80;&#x76F4;&#x5C31;&#x662F;&#x4E00;&#x573A;&#x707E;&#x96BE;&#xFF1B;&#x6240;&#x4EE5;&#x5728;&#x4EC0;&#x4E48;&#x65F6;&#x5019;&#x5C06;&#x67D0;&#x4E2A;&#x4EE3;&#x7801;&#x5757;&#x62BD;&#x8C61;&#x4E3A;&#x51FD;&#x6570;&#xFF0C;&#x5C06;&#x591A;&#x5C11;&#x903B;&#x8F91;&#x7684;&#x4EE3;&#x7801;&#x5757;&#x62BD;&#x8C61;&#x4E3A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#xFF0C;&#x8FD9;&#x5176;&#x5B9E;&#x662F;&#x7F16;&#x7A0B;&#x7684;&#x827A;&#x672F;&#xFF0C;&#x53D6;&#x51B3;&#x4E8E;&#x6BCF;&#x4E2A;&#x4EBA;&#x5BF9;&#x4E8E;&#x5B9E;&#x9645;&#x573A;&#x666F;&#x7684;&#x628A;&#x63E1;&#x3002;&#x4F46;&#x4E5F;&#x6709;&#x4E00;&#x4E9B;&#x53D8;&#x6210;&#x89C4;&#x8303;&#x53EF;&#x4F9D;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x901A;&#x5E38;&#x53EA;&#x5C06;&#x4E00;&#x4E2A;&#x529F;&#x80FD;&#x62BD;&#x8C61;&#x4E3A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#x6BCF;&#x4E2A;&#x51FD;&#x6570;&#x53EA;&#x5B9E;&#x73B0;&#x4E00;&#x4E2A;&#x5355;&#x4E00;&#x7684;&#x529F;&#x80FD;&#x3002;</p>
</blockquote>
<h4 id="&#x9762;&#x5411;&#x5BF9;&#x8C61;"><a name="&#x9762;&#x5411;&#x5BF9;&#x8C61;" class="anchor-navigation-ex-anchor" href="#&#x9762;&#x5411;&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x9762;&#x5411;&#x5BF9;&#x8C61;</h4>
<blockquote>
<p>&#x5F88;&#x591A;&#x5BF9;&#x4E8E;&#x7F16;&#x7A0B;&#x7A0D;&#x5FAE;&#x6709;&#x4E86;&#x89E3;&#x7684;&#x8BFB;&#x8005;&#x90FD;&#x77E5;&#x9053;&#xFF0C;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x662F;&#x5F88;&#x591A;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#x90FD;&#x6709;&#x7684;&#x4E00;&#x4E2A;&#x7279;&#x6027;&#xFF0C;&#x6240;&#x8C13;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x5176;&#x5B9E;&#x662F;&#x4E00;&#x79CD;&#x7F16;&#x7A0B;&#x7684;&#x601D;&#x8DEF;&#xFF0C;&#x4E0E;&#x4E4B;&#x4E0D;&#x540C;&#x7684;&#x601D;&#x8DEF;&#x8FD8;&#x6709;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#xFF1B;</p>
<p>&#x6BD4;&#x5982;&#x540C;&#x6837;&#x8981;&#x5B9E;&#x73B0;&#x76F8;&#x540C;&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4E0D;&#x540C;&#x7684;&#x601D;&#x8DEF;&#xFF0C;&#x601D;&#x8DEF;&#x6CA1;&#x6709;&#x5B70;&#x4F18;&#x5B70;&#x52A3;&#x4E4B;&#x5206;&#xFF0C;&#x53EA;&#x8981;&#x5728;&#x5F53;&#x524D;&#x573A;&#x666F;&#x9002;&#x7528;&#x5373;&#x53EF;</p>
</blockquote>
<p>&#x867D;&#x7136;Python&#x5B9E;&#x73B0;&#x4E00;&#x4E9B;&#x7B80;&#x5355;&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x53EA;&#x9700;&#x8981;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#x5373;&#x53EF;&#xFF0C;&#x6BD4;&#x5982;&#x5C06;&#x76EE;&#x6807;&#x573A;&#x666F;&#xFF0C;&#x62C6;&#x5206;&#x4E3A;&#x4E0D;&#x540C;&#x7684;&#x6B65;&#x9AA4;&#xFF0C;&#x5C06;&#x6BCF;&#x4E2A;&#x6B65;&#x9AA4;&#x5B9A;&#x4E49;&#x4E3A;&#x51FD;&#x6570;&#xFF0C;&#x7136;&#x540E;&#x901A;&#x8FC7;&#x7F16;&#x6392;&#x51FD;&#x6570;&#x53BB;&#x5B9E;&#x73B0;&#x6700;&#x7EC8;&#x7684;&#x76EE;&#x6807;&#xFF0C;&#x4F46;Python&#x672C;&#x8EAB;&#x4ECE;&#x8BBE;&#x8BA1;&#x4E4B;&#x5904;&#x5C31;&#x662F;&#x4E00;&#x95E8;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x8BED;&#x8A00;&#xFF0C;&#x5E76;&#x4E14;<strong>Python&#x4E2D;&#x4E00;&#x5207;&#x7686;&#x5BF9;&#x8C61;</strong>&#x3002;</p>
<p>&#x90A3;&#x4E48;&#x5BF9;&#x8C61;&#x7A76;&#x7ADF;&#x662F;&#x4EC0;&#x4E48;&#xFF1A;&#x4E16;&#x754C;&#x4E0A;&#x7684;&#x4EFB;&#x4F55;&#x4E8B;&#x7269;&#x90FD;&#x53EF;&#x4EE5;&#x628A;&#x5B83;&#x770B;&#x6210;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x5176;&#x5177;&#x6709;&#x81EA;&#x5DF1;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x884C;&#x4E3A;&#xFF0C;&#x4E0D;&#x540C;&#x7684;&#x5BF9;&#x8C61;&#x4E4B;&#x95F4;&#x901A;&#x8FC7;&#x65B9;&#x6CD5;&#x6765;&#x4EA4;&#x4E92;&#x3002;</p>
<p>&#x6BD4;&#x5982;Python&#x4E2D;&#x7684;&#x67D0;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5B83;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x5B83;&#x5177;&#x6709;&#x81EA;&#x5DF1;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;&#xFF0C;&#x5982;&#x4E0B;</p>
<pre><code class="lang-python">root&gt; <span class="hljs-comment"># a = &quot;string&quot;</span>
root&gt; <span class="hljs-comment"># dir(a)</span>
[<span class="hljs-string">&apos;__add__&apos;</span>, <span class="hljs-string">&apos;__class__&apos;</span>, <span class="hljs-string">&apos;__contains__&apos;</span>, <span class="hljs-string">&apos;__delattr__&apos;</span>, <span class="hljs-string">&apos;__dir__&apos;</span>, <span class="hljs-string">&apos;__doc__&apos;</span>, <span class="hljs-string">&apos;__eq__&apos;</span>, <span class="hljs-string">&apos;__format__&apos;</span>, <span class="hljs-string">&apos;__ge__&apos;</span>, <span class="hljs-string">&apos;__getattribute__&apos;</span>, <span class="hljs-string">&apos;__getitem__&apos;</span>, <span class="hljs-string">&apos;__getnewargs__&apos;</span>, 
<span class="hljs-string">&apos;__gt__&apos;</span>, <span class="hljs-string">&apos;__hash__&apos;</span>, <span class="hljs-string">&apos;__init__&apos;</span>, <span class="hljs-string">&apos;__init_subclass__&apos;</span>, <span class="hljs-string">&apos;__iter__&apos;</span>, <span class="hljs-string">&apos;__le__&apos;</span>, <span class="hljs-string">&apos;__len__&apos;</span>, <span class="hljs-string">&apos;__lt__&apos;</span>, <span class="hljs-string">&apos;__mod__&apos;</span>, <span class="hljs-string">&apos;__mul__&apos;</span>, <span class="hljs-string">&apos;__ne__&apos;</span>, <span class="hljs-string">&apos;__new__&apos;</span>, <span class="hljs-string">&apos;__reduce__&apos;</span>, <span class="hljs-string">&apos;__reduce_ex__&apos;</span>, <span class="hljs-string">&apos;__repr__&apos;</span>, <span class="hljs-string">&apos;__rmod__&apos;</span>, <span class="hljs-string">&apos;__rmul__&apos;</span>, <span class="hljs-string">&apos;__setattr__&apos;</span>, <span class="hljs-string">&apos;__sizeof__&apos;</span>, <span class="hljs-string">&apos;__str__&apos;</span>, <span class="hljs-string">&apos;__subclasshook__&apos;</span>, <span class="hljs-string">&apos;capitalize&apos;</span>, <span class="hljs-string">&apos;casefold&apos;</span>, <span class="hljs-string">&apos;center&apos;</span>, <span class="hljs-string">&apos;count&apos;</span>, <span class="hljs-string">&apos;encode&apos;</span>, <span class="hljs-string">&apos;endswith&apos;</span>, <span class="hljs-string">&apos;expandtabs&apos;</span>, <span class="hljs-string">&apos;find&apos;</span>, <span class="hljs-string">&apos;format&apos;</span>, <span class="hljs-string">&apos;format_map&apos;</span>, <span class="hljs-string">&apos;index&apos;</span>, <span class="hljs-string">&apos;isalnum&apos;</span>, <span class="hljs-string">&apos;isalpha&apos;</span>, <span class="hljs-string">&apos;isascii&apos;</span>, <span class="hljs-string">&apos;isdecimal&apos;</span>, <span class="hljs-string">&apos;isdigit&apos;</span>, <span class="hljs-string">&apos;isidentifier&apos;</span>, <span class="hljs-string">&apos;islower&apos;</span>, <span class="hljs-string">&apos;isnumeric&apos;</span>, <span class="hljs-string">&apos;isprintable&apos;</span>, <span class="hljs-string">&apos;isspace&apos;</span>, <span class="hljs-string">&apos;istitle&apos;</span>, <span class="hljs-string">&apos;isupper&apos;</span>, <span class="hljs-string">&apos;join&apos;</span>, <span class="hljs-string">&apos;ljust&apos;</span>, <span class="hljs-string">&apos;lower&apos;</span>, <span class="hljs-string">&apos;lstrip&apos;</span>, <span class="hljs-string">&apos;maketrans&apos;</span>, <span class="hljs-string">&apos;partition&apos;</span>, <span class="hljs-string">&apos;replace&apos;</span>, <span class="hljs-string">&apos;rfind&apos;</span>, <span class="hljs-string">&apos;rindex&apos;</span>, <span class="hljs-string">&apos;rjust&apos;</span>, <span class="hljs-string">&apos;rpartition&apos;</span>, <span class="hljs-string">&apos;rsplit&apos;</span>, 
<span class="hljs-string">&apos;rstrip&apos;</span>, <span class="hljs-string">&apos;split&apos;</span>, <span class="hljs-string">&apos;splitlines&apos;</span>, <span class="hljs-string">&apos;startswith&apos;</span>, <span class="hljs-string">&apos;strip&apos;</span>, <span class="hljs-string">&apos;swapcase&apos;</span>, <span class="hljs-string">&apos;title&apos;</span>, <span class="hljs-string">&apos;translate&apos;</span>, <span class="hljs-string">&apos;upper&apos;</span>, <span class="hljs-string">&apos;zfill&apos;</span>]
</code></pre>
<p>&#x6211;&#x4EEC;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#x53D8;&#x91CF;a&#xFF0C;&#x901A;&#x8FC7;<code>dir</code>&#x65B9;&#x6CD5;&#x6765;&#x67E5;&#x770B;&#x5176;&#x6240;&#x5177;&#x6709;&#x7684;&#x6240;&#x6709;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;&#x3002;</p>
<p>&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x53EA;&#x662F;&#x89E3;&#x51B3;&#x95EE;&#x9898;&#x7684;&#x601D;&#x8DEF;&#xFF0C;&#x6211;&#x4EEC;&#x5E76;&#x4E0D;&#x662F;&#x5C06;&#x95EE;&#x9898;&#x62C6;&#x89E3;&#x4E3A;&#x4E0D;&#x540C;&#x7684;&#x6B65;&#x9AA4;&#xFF0C;&#x800C;&#x662F;&#x5C06;&#x95EE;&#x9898;&#x5206;&#x89E3;&#x4E3A;&#x4E0D;&#x540C;&#x7684;&#x5BF9;&#x8C61;&#xFF0C;&#x5728;&#x6211;&#x4EEC;&#x7684;CMDBv1.0&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x8981;&#x89E3;&#x51B3;&#x7684;&#x95EE;&#x9898;&#x5C31;&#x662F;&#x5B9E;&#x73B0;&#x8D44;&#x4EA7;&#x4FE1;&#x606F;&#x7684;&#x589E;&#x5220;&#x6539;&#x67E5;&#xFF0C;&#x90A3;&#x4E48;&#x6211;&#x4EEC;&#x5206;&#x6790;&#x8BE5;&#x95EE;&#x9898;&#x53D1;&#x73B0;&#x9700;&#x8981;&#x4E24;&#x4E2A;&#x5BF9;&#x8C61;&#x6765;&#x89E3;&#x51B3;&#xFF1A;</p>
<ul>
<li>&#x8D44;&#x4EA7;&#x5BF9;&#x8C61;<ul>
<li>&#x5C5E;&#x6027;&#xFF1A;&#x53EF;&#x4EE5;&#x6267;&#x884C;&#x7684;&#x64CD;&#x4F5C;&#xFF0C;&#x5F53;&#x524D;&#x7684;&#x7248;&#x672C;&#xFF0C;&#x521B;&#x5EFA;&#x65F6;&#x95F4;&#xFF0C;&#x4E0A;&#x6B21;&#x4FEE;&#x6539;&#x7684;&#x65F6;&#x95F4;&#x7B49;</li>
<li>&#x65B9;&#x6CD5;&#xFF1A;&#x589E;&#x3001;&#x5220;&#x3001;&#x6539;&#x3001;&#x67E5;</li>
</ul>
</li>
<li>&#x4FE1;&#x606F;&#x5B58;&#x50A8;&#x5BF9;&#x8C61;<ul>
<li>&#x5C5E;&#x6027;&#xFF1A;&#x5B58;&#x50A8;&#x7684;&#x4F4D;&#x7F6E;&#xFF0C;&#x6570;&#x636E;&#x7684;&#x5927;&#x5C0F;</li>
<li>&#x65B9;&#x6CD5;&#xFF1A;&#x5B58;&#xFF0C;&#x53D6;</li>
</ul>
</li>
</ul>
<p>&#x6240;&#x4EE5;&#x7ECF;&#x8FC7;&#x6211;&#x4EEC;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x62C6;&#x89E3;&#xFF0C;&#x6700;&#x7EC8;&#x5C06;&#x6211;&#x4EEC;&#x7684;&#x95EE;&#x9898;&#x4ECE;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#xFF0C;&#x5373;&#x6839;&#x636E;&#x547D;&#x4EE4;&#x884C;&#x53C2;&#x6570;&#x7684;&#x4F20;&#x5165;&#x53BB;&#x6267;&#x884C;&#x4E0D;&#x540C;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x800C;&#x4FEE;&#x6539;&#x4E3A;&#x4E86;&#x6211;&#x4EEC;&#x4E0E;&#x8D44;&#x4EA7;&#x5BF9;&#x8C61;&#x8FDB;&#x884C;&#x4EA4;&#x4E92;&#xFF0C;&#x800C;&#x8D44;&#x4EA7;&#x5BF9;&#x8C61;&#x4E0E;&#x5B58;&#x50A8;&#x5BF9;&#x8C61;&#x8FDB;&#x884C;&#x4EA4;&#x4E92;&#x3002;</p>
<h4 id="&#x77E5;&#x8BC6;&#x603B;&#x7ED3;"><a name="&#x77E5;&#x8BC6;&#x603B;&#x7ED3;" class="anchor-navigation-ex-anchor" href="#&#x77E5;&#x8BC6;&#x603B;&#x7ED3;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x77E5;&#x8BC6;&#x603B;&#x7ED3;</h4>
<ul>
<li><p>&#x5F00;&#x59CB;&#x521D;&#x6B65;&#x9605;&#x8BFB;CMDBv1.0&#x7248;&#x672C;&#x7684;&#x6E90;&#x7801;</p>
</li>
<li><p>&#x8BB2;&#x89E3;&#x4E86;Python&#x57FA;&#x672C;&#x7684;&#x6761;&#x4EF6;&#x8BED;&#x53E5;&#x548C;&#x5FAA;&#x73AF;&#x8BED;&#x53E5;</p>
</li>
<li><p>&#x8BB2;&#x89E3;&#x4E86;Python&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x4EE5;&#x53CA;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x5206;&#x6790;</p>
</li>
</ul>
<p>CMDB&#x7CFB;&#x5217;&#x7B2C;&#x4E8C;&#x8282;&#x6211;&#x4EEC;&#x5C31;&#x6682;&#x4E14;&#x8BB2;&#x5230;&#x8FD9;&#x91CC;&#xFF0C;&#x5BF9;&#x4E8E;&#x5224;&#x65AD;&#x8BED;&#x53E5;&#x548C;&#x5FAA;&#x73AF;&#x8BED;&#x53E5;&#x8FD8;&#x6709;&#x5F88;&#x591A;&#x7EC6;&#x8282;&#x6CA1;&#x6709;&#x6D89;&#x53CA;&#x5230;&#xFF0C;&#x4F46;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x638C;&#x63E1;&#x4E86;&#x5176;&#x57FA;&#x672C;&#x7684;&#x539F;&#x7406;&#xFF0C;&#x5E76;&#x4E14;&#x6211;&#x4EEC;&#x4E86;&#x89E3;&#x4E86;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x601D;&#x8DEF;&#x3002;</p>
<p>&#x540E;&#x9762;&#x7684;&#x7AE0;&#x8282;&#x6211;&#x4EEC;&#x4F1A;&#x7EE7;&#x7EED;&#x9605;&#x8BFB;CMDBv1.0&#x7684;&#x6E90;&#x7801;&#xFF0C;&#x4E86;&#x89E3;&#x66F4;&#x4E3A;&#x7EC6;&#x8282;&#x7684;&#x5185;&#x5BB9;&#xFF0C;&#x5E76;&#x4E14;&#x7528;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x601D;&#x8DEF;&#x5C06;CMDBv1.0&#x6539;&#x9020;&#x4E3A;CMDBv1.5&#xFF0C;&#x656C;&#x8BF7;&#x671F;&#x5F85;&#x3002;</p>
<blockquote>
<p><strong>&#x7BC7;&#x540E;&#x8BED;</strong></p>
<p>&#x5F88;&#x591A;&#x8BFB;&#x8005;&#x5728;&#x9605;&#x8BFB;&#x7684;&#x8FC7;&#x7A0B;&#x4E2D;&#x53EF;&#x80FD;&#x53D1;&#x73B0;&#xFF0C;&#x6211;&#x4EEC;&#x5F88;&#x591A;&#x7684;&#x77E5;&#x8BC6;&#x90FD;&#x662F;&#x6D45;&#x5C1D;&#x8F84;&#x6B62;&#xFF0C;&#x770B;&#x4F3C;&#x90FD;&#x662F;&#x4E00;&#x4E9B;&#x76AE;&#x6BDB;&#xFF0C;&#x5E76;&#x6CA1;&#x6709;&#x4EC0;&#x4E48;&#x771F;&#x6750;&#x5B9E;&#x6599;&#xFF0C;&#x5305;&#x62EC;&#x9605;&#x8BFB;&#x6E90;&#x7801;&#x4E5F;&#x662F;&#xFF0C;&#x53EA;&#x770B;&#x4E86;&#x4E2A;&#x5927;&#x6982;&#xFF1B;&#x5176;&#x5B9E;&#x4E0D;&#x7136;&#xFF0C;&#x5F53;&#x6211;&#x4EEC;&#x65B0;&#x4E0A;&#x624B;&#x4E00;&#x95E8;&#x65B0;&#x7684;&#x6280;&#x672F;&#x65F6;&#xFF0C;&#x6211;&#x4EEC;&#x5E76;&#x4E0D;&#x80FD;&#x63EA;&#x4F4F;&#x4E00;&#x4E2A;&#x77E5;&#x8BC6;&#x70B9;&#x4E0D;&#x653E;&#xFF0C;&#x6BD4;&#x5982;&#x5B57;&#x7B26;&#x4E32;&#x662F;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x901A;&#x8FC7;<code>dir</code>&#x53EF;&#x4EE5;&#x53D1;&#x73B0;&#x5B83;&#x6709;&#x4E8C;&#x5341;&#x591A;&#x4E2A;&#x5C5E;&#x6027;&#x548C;&#x4E8C;&#x5341;&#x591A;&#x4E2D;&#x65B9;&#x6CD5;&#xFF0C;&#x4F46;&#x6211;&#x4EEC;&#x96BE;&#x9053;&#x8981;&#x5728;&#x4E00;&#x5F00;&#x59CB;&#x5C31;&#x90FD;&#x638C;&#x63E1;&#x5E76;&#x628A;&#x4ED6;&#x4EEC;&#x80CC;&#x4F1A;&#x5417;&#xFF1F;&#x7B54;&#x6848;&#x5F53;&#x7136;&#x662F;&#x5426;&#x5B9A;&#x7684;&#xFF0C;&#x8FD9;&#x4E9B;&#x7EC6;&#x8282;&#x6211;&#x4EEC;&#x521D;&#x671F;&#x90FD;&#x4E0D;&#x9700;&#x8981;&#x53BB;&#x6DF1;&#x7A76;&#xFF0C;&#x6211;&#x4EEC;&#x7684;&#x573A;&#x666F;&#x662F;&#x6784;&#x5EFA;&#x4E00;&#x4E2A;&#x7B80;&#x6613;&#x7248;CMDB&#xFF0C;&#x90A3;&#x4E48;&#x6211;&#x4EEC;&#x53EA;&#x9700;&#x8981;&#x4E00;&#x6B65;&#x4E00;&#x6B65;&#x5C06;&#x8FD9;&#x8FC7;&#x7A0B;&#x4E2D;&#x963B;&#x788D;&#x6211;&#x4EEC;&#x524D;&#x8FDB;&#x7684;&#x77E5;&#x8BC6;&#x638C;&#x63E1;&#x5373;&#x53EF;&#xFF0C;&#x5177;&#x4F53;&#x7684;&#x7EC6;&#x8282;&#x53EF;&#x4EE5;&#x5728;&#x540E;&#x7EED;&#x7684;&#x6DF1;&#x5165;&#x8FC7;&#x7A0B;&#x4E2D;&#x53BB;&#x6162;&#x6162;&#x4E86;&#x89E3;&#x3002;&#x8FD9;&#x4E5F;&#x662F;&#x4E3A;&#x4EC0;&#x4E48;&#x5F88;&#x591A;&#x5B66;&#x751F;&#x4E0D;&#x613F;&#x610F;&#x542C;&#x8001;&#x5E08;&#x8BB2;&#x8BFE;&#x7684;&#x539F;&#x56E0;&#xFF0C;&#x56E0;&#x4E3A;&#x4ED6;&#x5E76;&#x4E0D;&#x77E5;&#x9053;&#x6211;&#x8FD9;&#x8282;&#x8BFE;&#x5B66;&#x7684;&#x77E5;&#x8BC6;&#x70B9;&#x6709;&#x4EC0;&#x4E48;&#x7528;&#xFF0C;&#x53EA;&#x662F;&#x673A;&#x68B0;&#x7684;&#x63A5;&#x53D7;&#x8001;&#x5E08;&#x7684;&#x704C;&#x8F93;&#xFF0C;&#x6240;&#x4EE5;&#x597D;&#x7684;&#x5B66;&#x4E60;&#x65B9;&#x6CD5;&#x4E00;&#x5B9A;&#x662F;&#x81EA;&#x9876;&#x5411;&#x4E0B;&#x7684;&#xFF0C;&#x5E0C;&#x671B;&#x8BFB;&#x8005;&#x670B;&#x53CB;&#x4EEC;&#x80FD;&#x4F53;&#x4F1A;&#x5230;&#x5176;&#x771F;&#x6B63;&#x7684;&#x5185;&#x6DB5;&#x3002;</p>
</blockquote>
<p><strong>&#x6B22;&#x8FCE;&#x5927;&#x5BB6;&#x6DFB;&#x52A0;&#x6211;&#x7684;&#x4E2A;&#x4EBA;&#x516C;&#x4F17;&#x53F7;&#x3010;Python&#x73A9;&#x8F6C;&#x81EA;&#x52A8;&#x5316;&#x8FD0;&#x7EF4;&#x3011;&#x52A0;&#x5165;&#x8BFB;&#x8005;&#x4EA4;&#x6D41;&#x7FA4;&#xFF0C;&#x83B7;&#x53D6;&#x66F4;&#x591A;&#x5E72;&#x8D27;&#x5185;&#x5BB9;</strong></p>
<p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/1c7e9f104c31490ba76d59306f1cf56a~tplv-k3u1fbpfcp-watermark.awebp" width="300" height="300"> </p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; https://ronin-yue.gitee.io/gitbook-demo all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x7AE0;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2022-03-01 11:05:39
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style> 
          </section>
          
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>
 
          <div class="book-footer">
            
            <div class="donate">
              <div>『 赠人玫瑰 🌹 手有余香 』</div>
              <button class="donate-btn" onclick="showModal()">赞赏</button>
            </div>
             
            <div class="copyright"></div>
            
          </div>
          
        </div>
      </div>
      
    </div>

     
    <a
      href="../"
      class="
        navigation navigation-prev
        
      "
      aria-label="Previous page: 第一章"
    >
      <i class="fa fa-angle-left"></i>
    </a>
     
    <a
      href="../2第二节/"
      class="
        navigation navigation-next
        
      "
      aria-label="Next page: 第一章 第2节"
    >
      <i class="fa fa-angle-right"></i>
    </a>
      
  </div>
  <script>
    function showModal() {
      document.getElementsByClassName("mask")[0].style.display = "block";
      document.getElementsByClassName("donate-modal")[0].style.display =
        "block";
    }
    // 切换赞赏码
    function showDonateImg(num) {
      let alipay = "";
      let wxpay = ""
      if(num){
        wxpay = "hidden"
      }else{
        alipay = "hidden"
      }
      document.getElementById("wxpay-code").hidden = wxpay;
      document.getElementById("alipay-code").hidden = alipay;
      document.getElementsByName("pay-way")[num].checked = "checked";
    }

    // 关闭赞赏框
    function closeDonateModal() {
      document.getElementsByClassName("mask")[0].style.display = "none";
      document.getElementsByClassName("donate-modal")[0].style.display = "none";
    }

    var gitbook = gitbook || [];
    gitbook.push(function () {
      gitbook.page.hasChanged({"page":{"title":"第一章 第1节","level":"1.3.1","depth":2,"next":{"title":"第一章 第2节","level":"1.3.2","depth":2,"path":"1第一章/2第二节/README.md","ref":"./1第一章/2第二节/README.md","articles":[]},"previous":{"title":"第一章","level":"1.3","depth":1,"path":"1第一章/README.md","ref":"./1第一章/README.md","articles":[{"title":"第一章 第1节","level":"1.3.1","depth":2,"path":"1第一章/1第一节/README.md","ref":"./1第一章/1第一节/README.md","articles":[]},{"title":"第一章 第2节","level":"1.3.2","depth":2,"path":"1第一章/2第二节/README.md","ref":"./1第一章/2第二节/README.md","articles":[]},{"title":"第一章 第3节","level":"1.3.3","depth":2,"path":"1第一章/3第三节/README.md","ref":"./1第一章/3第三节/README.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["-lunr","-sharing","-search","-favicon","code","expandable-chapters","theme-lou","mind-maps","ck-theme","chapter-fold","page-treeview","splitter","popup","sharing-plus","ancre-navigation","flexible-alerts","insert-logo","tbfed-pagefooter","search-pro"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy https://ronin-yue.gitee.io/gitbook-demo","modify_label":"该文章修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"page-treeview":{"copyright":"Copyright &#169; EthanYue","minHeaderCount":"2","minHeaderDeep":"2","collapsed":false},"chapter-fold":{},"ck-theme":{},"splitter":{},"search-pro":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"popup":{},"code":{"copyButtons":true},"theme-lou":{"color":"#2096FF","favicon":"assets/favicon.ico","logo":"assets/logo.png","autoNumber":3,"forbidCopy":true,"search-placeholder":"自动化运维","hide-elements":[".summary .gitbook-link"],"copyright":{"author":"EthanYue"}},"fontsettings":{"theme":"white","family":"sans","size":2},"mind-maps":{},"highlight":{},"ancre-navigation":{"showLevel":true,"associatedWithSummary":true,"mode":"float","printLog":false,"multipleH1":true,"float":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""}},"flexible-alerts":{"style":"callout","note":{"label":"Note","icon":"fa fa-info-circle","className":"info"},"tip":{"label":"Tip","icon":"fa fa-lightbulb-o","className":"tip"},"warning":{"label":"Warning","icon":"fa fa-exclamation-triangle","className":"warning"},"danger":{"label":"Attention","icon":"fa fa-ban","className":"danger"}},"sharing":{"qq":true,"all":["douban","facebook","google","instapaper","linkedin","twitter","weibo","messenger","qq","qzone","viber","whatsapp"],"douban":true,"facebook":true,"weibo":true,"twitter":true,"pocket":true,"google":true,"qzone":true},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"insert-logo":{"url":"https://p6-passport.byteacctimg.com/img/user-avatar/2dc12c49f15346739befd9e1f77f82f3~300x300.image","style":"background: none; max-height: 80px; min-height: 80px"},"expandable-chapters":{}},"theme":"default","author":"EthanYue","lang":"zh-cn","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"themeLou":{"nav":[{"target":"_blank","url":"https://juejin.cn/user/3175847616053341","name":"知乎"},{"target":"_blank","url":"https://blog.csdn.net/weixin_40489165?type=blog","name":"CSDN"}],"footer":{"donate":{"button":"赞赏","avatar":"assets/touxiang.jpg","nickname":"作者","message":"随意打赏，但不要超过一顿早餐钱 💕","text":"『 赠人玫瑰 🌹 手有余香 』","wxpay":"http://xkapp-uat.oss-cn-hangzhou.aliyuncs.com/2e7a3f70-80ab-4b50-93ec-a04dfeef949b/wxpay-any-200.png","alipay":"background.jpg"},"copyright":true}}},"title":"Python玩转自动化运维","gitbook":"*","description":"Python玩转自动化运维"},"file":{"path":"1第一章/1第一节/README.md","mtime":"2022-03-01T03:05:39.278Z","type":"markdown"},"gitbook":{"version":"3.1.0","time":"2022-03-01T08:12:31.618Z"},"basePath":"../..","book":{"language":""}});
    });
  </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-mind-maps/mindmaps.dist.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-ck-theme/test.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-insert-logo/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-lou/lou.js"></script>
        
    

    </body>
</html>

